package com.example.testapplication;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.List;

/**
 * A simple {@link Fragment} subclass.
 * Activities that contain this fragment must implement the
 * {@link HotSpotFragment.OnFragmentInteractionListener} interface
 * to handle interaction events.
 * Use the {@link HotSpotFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class FollowFragment extends Fragment {

    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_follow,container,false);
        RecyclerView recyclerViewFollow = view.findViewById(R.id.recyclerViewFollow);
        List<Question> list = new ArrayList<>();
        for (int i = 0; i < 10; i++){
            Question question = new Question();
            if (i%2 == 0) {
                question.setTitle("造价员不看后悔：工程造价材料换算方法"+i);
            }
            else{
                question.setTitle("浙江省最新公开的智能化招标要求"+i);

            }
            list.add(question);
        }

        RecyclerViewFollowAdapter adapter = new RecyclerViewFollowAdapter(list);
        LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false);
        recyclerViewFollow.setLayoutManager(layoutManager);
        recyclerViewFollow.setAdapter(adapter);
        return view;
    }

}
